<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/static/include/taglib.jsp"%>
<!DOCTYPE html >
<html>
<head>
 <meta name="viewport" content="width=device-width" />
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />  
 <title>后台管理--模板编辑</title>
 <link href="${ctxStatic}/layui/css/layui.css" rel="stylesheet" />
 
 <link href="${ctxStatic}/css/kpiuitanchu.css" rel="stylesheet" />
 <script src="${ctxStatic}/js/jquery-1.8.3.min.js?v=2.0" type="text/javascript"></script>
 <script src="${ctxStatic}/layui/layui.all.js"  type="text/javascript"></script>
 <style>
 .selftable tbody td{height:28px;color:#ffffff}
  .selftable tbody td input{text-align: center}
  .layui-table-edit{position: static;}
  .selftable .layui-input, .layui-select, .layui-textarea{height:auto}
  .input_back{background: transparent;}
  .selftable .layui-textarea{margin-top:0;background: transparent;border:0;
  height:auto;line-height:20px;resize:none}
  
  
  
  .layui-layer-title{height:30px;font-size:14px;line-height:30px;color:#fff;
margin:3px 3px 0 3px !important;background: rgba(11,137,198,0.81);
box-shadow: inset 0 0 24px 0 rgba(6,152,224,0.63);border-bottom:0;}
.layui-layer-setwin{top:12px;color:#fff}   
.layui-layer-iframe .layui-layer-close{background:url(../static/images/window/CombinedShape.png) no-repeat;background-size:100% 100% !important;}

.layui-layer-shade{/*background: rgba(0,4,29,0.40) !important;*/
background-color: rgb(0,4,29)!important;
    opacity: 0.8 !important;}
.layui-layer-iframe{/*background:url(../images/window/form_bg.png) no-repeat !important;*/background:url(../static/images/index/bg03.png) no-repeat !important;background-size:100% 100% !important;overflow: hidden;
background: rgba(1,71,105,0.18);
/*box-shadow: inset 0 -6px 24px 0 rgba(57,124,225,0.63);*/}
.layui-layer-content{margin:0 10px 5px 5px}

  
 </style>
</head>
<body>
<div style="padding-left:10px">
 <form class="layui-form" id="formedit" name="formedit" action="create_templateindex" method="post" target="d41d8cd98f00b204e9800998ecf8427e">
      <iframe name="d41d8cd98f00b204e9800998ecf8427e" src="about:blank" style="display:none;"></iframe>
      
        <div style="margin:0 auto;margin-top: 10px;width:90%;color:#ffffff">
        <table style="width:100%" >
         <tr>
          <td style="width:70px;text-align: right">  模板名称：</td>
          <td style="width:200px">
           <input type="text" name="templatename" lay-verify="required" autocomplete="off" class="layui-input"  value="${ustempentity.templatename }">
          </td>
          <td style="text-align: right">考核期开始时间：</td>
          <td style="width:120px">
           <input type="text" id="begintime" name="begintime" lay-verify="required|date" autocomplete="off" class="layui-input" value="<fmt:formatDate value='${ustempentity.begintime}' pattern='yyyy-MM-dd'/>">
          </td>
          <td style="text-align: right">考核期结束时间：</td>
          <td style="width:120px">
           <input type="text" id="endtime" name="endtime" lay-verify="required|date" autocomplete="off" class="layui-input" value="<fmt:formatDate value='${ustempentity.endtime}' pattern='yyyy-MM-dd'/>" >
          </td>
        
         </tr>
         
       
         <tr>
            <td style="width:70px;text-align: right">描述：</td>
          <td colspan="3" style="height:50px">
            <textarea class="layui-textarea" style="height:50px;min-height:50px" rows="2" name="templatedes"  >${ustempentity.templatedes }</textarea>
          </td>
          <td style="text-align: center" colspan="2">
           <input type="button" class="button"  onclick="openindex(0)" value="添加指标"/>
          
           <button class="button" lay-submit="" lay-filter="demo1" id="btnsave">保存模板</button>
           <input type="button" value="关闭" class="button" style="margin-top:10px" onclick="top.CloseOpenWindow()"/>
          </td>
         </tr>
         </table>
      </div>
      
      
       <div class="indexcontent" style="margin-top:10px">
         <table cellspacing="0" cellpadding="0" border="0" class="layui-table" style="margin:0;">
          <col width="80px"></col> 
          <col width="100px"></col> 
          <col width="200px"></col> 
          <col width="100px"></col>
          <col ></col>
         
              <thead>
                <tr>
                  <!--  <th style="height:30px"><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"></th>-->
                  <th>操作</th>
                  <th >内容</th>
                  <th>考核指标</th>
                  <th >分值设置</th>
                  <th >评价标准</th>
                 
                </tr> 
              </thead>
         </table>
       
       <div class="selftable" id="selftable">
         <table cellspacing="0" cellpadding="0" border="0" class="layui-table" style="margin:0;" id="tableinput">
          <col width="80px"></col> 
          <col width="100px"></col> 
          <col width="200px"></col> 
          <col width="100px"></col>
          <col ></col>
        
              <tbody>
               <c:forEach var="item" items="${lst}">
                 <tr>
                  <!--<c:if test="${item.ischecked==0 }">
                    <td><input type="checkbox" name="cb_${item.assindexid}" lay-skin="primary"></td>
                  </c:if>
                  <c:if test="${item.ischecked==1 }">
                    <td><input type="checkbox" name="cb_${item.assindexid}" checked="checked" lay-skin="primary"></td>
                  </c:if>-->
                  <td>
                    <img onclick="deleteindex(${item.assindexid},${item.parentid},${item.rowspan})" class="btn-img" src="${ctxStatic}/images/index/btn_delete.png" style="cursor: pointer;"  alt="删除" title="删除">
                    <img class="btn-img" onclick="openindex(${item.assindexid})" src="${ctxStatic}/images/index/btn_edit.png" style="cursor: pointer;" alt="编辑" title="编辑">
                  </td>
                
                 <c:if test="${item.rowspan!=0 }">
                  <td rowspan="${item.rowspan}" style="vertical-align: middle" valign="middle"><input style="vertical-align: middle" name="uasscontent_${item.parentid}" class="layui-input layui-table-edit input_back" type="text" readonly="readonly" value="${item.uasscontent}"></td>
                 </c:if>
                  <td><input name="uassingredients_${item.assindexid}" readonly="readonly" class="layui-input layui-table-edit input_back" type="text" value="${item.uassingredients}"></td>
                  <td><input name="score_${item.assindexid}" readonly="readonly" class="layui-input layui-table-edit input_back" type="text" value="${item.score}"></td>
                  <td>
                    <textarea class="layui-textarea" readonly="readonly" name="evaluationstandard_${item.assindexid}" >${item.evaluationstandard}</textarea>
                    <!-- <input name="evaluationstandard_${item.assindexid}" readonly="readonly" class="layui-input layui-table-edit input_back" type="text" value="${item.evaluationstandard}"> -->
                  </td>
                  <td>
                   <input type="hidden" name="parentid_${item.assindexid}" value="${item.parentid}">
                  </td>
                </tr>
               </c:forEach>
               
              </tbody>
            </table>
       </div>
     </div>

    
      <input type="hidden" value="${pagestring.keyword1}" name="parentids" >
      <input type="hidden" value="${pagestring.keyword2}" name="assindexids" >
      <input type="hidden" value="${templateid}" name="templateid" id="templateid">
      <input type="hidden" value="${groupid}" name="groupid" id="hidgroupid">
      
     </form>
     
     <script>
     var openindexpage;
     var layeruiindex=null;
     layui.use(['form','laydate','layer'], function() {
		 var form = layui.form;
		 layeruiindex = layui.layer;
		 var laydate = layui.laydate;
		 $("#selftable").height($(window).height()-150);
		 
		 form.on('checkbox(allChoose)', function(data){  
	            var child = $("#tableinput").find('tbody input[type="checkbox"]');  
	            child.each(function(index, item){ 
	              item.checked = data.elem.checked;  
	            });  
	            form.render('checkbox');  
	        });  
		 laydate.render({
			    elem: '#begintime'
		   });
		   laydate.render({
			    elem: '#endtime'
		   });
		   form.render();
		   
	});
     
     
  function openindex(assindexid){
	  openindexpage=null;
	  openindexpage=layeruiindex.open({
   	         type: 2,
   	         title: '指标添加',
   	         shadeClose: true,
   	         shade: 0.5,
   	         area: ['600px', '430px'],
   	         content: '../usertemp/user_temp_addindex?assindexid='+assindexid+'&groupid='+$("#hidgroupid").val()+'&templateid='+$("#templateid").val()
   	       }); 
   	
   }
  
  function CloseWin(){
	  layer.close(openindexpage);
  }

  function addresult(result,msg){
	  if(result>0){
			top.mylayui.msg('操作成功', {icon: 1});
			layer.close(openindexpage);
			//vTemplate.searchtable();
			document.location.reload();
		}
		else{
			if(msg){
				top.mylayui.msg(msg, {icon: 0});
			}else{
				top.mylayui.msg('操作失败', {icon: 0});
			}
		}
  }
  
     function CloseDialog(result,msg){
    	 top.frames["iframe"].vUserTemp.addresult(result,msg);		
      }
     
     
     
     
     
function deleteindex(assindexid,parentid,rowspan){
    	 top.mylayui.confirm('确定要删除吗？',{icon: 0}, function(index){
       	 top.mylayui.close(index);
    	
    	$.ajax({
    		type:"POST",
    		url:"delete_index",
    		data:{assindexid:assindexid,parentid:parentid,rowspan:rowspan},
    		beforeSend:function(XHR){
    			
    		},
    		success:function(data){
    			data=eval('('+data+')');
    			if(data.result>0){
    				top.mylayui.msg(data.msg, {icon: 1});
    				//vOrg.searchtable();
    				document.location.reload();
    			}
    			else{
    				top.mylayui.msg(data.msg, {icon: 0});
    			}
    		},
    		complete:function(XHR){
    			
    		},
    		error:function(){
    			
    		}
    	})
    	 })
}

     
     </script>
     
     
</div>
</body>
</html>